package org.ezplatform.office.forum.dao;

import java.util.List;

import org.ezplatform.core.dao.jpa.JpaBaseDao;
import org.ezplatform.office.forum.entity.ForumBoard;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 *  论坛板块dao
 * 2019年11月2日17:40:59
 * @author Administrator
 *
 */
@Repository
public interface ForumBoardDao extends JpaBaseDao<ForumBoard, String> {
	            
	@Query(" from ForumBoard where id = ?1  ")
	ForumBoard getForumBoard(String id);
	 
	@Query(" from ForumBoard where code = ?1 and corpId =?2 and is_delete = 0 ")
	ForumBoard getBoardByCode(String code,String corpId);
	 
	@Modifying
	@Query(nativeQuery = true, value = "update oa_forum_board set moderator = ?1 where id = ?2")
	int updateModerator(String moderator,String id);
	
	@Modifying
	@Query(nativeQuery = true, value = "update oa_forum_board set is_delete = ?1 where id in (?2)")
	int setBoardDel(int isDelete,List<String> list);
	
	@Query(" from ForumBoard where corpId = ?1 and status = 1  ")
	List<ForumBoard> getAllForumBoard(String corpId);
	
	@Query(" from ForumBoard where corpId = 0 and is_delete = 0 ORDER BY createdDate DESC ")
	List<ForumBoard> getALLBoard();

	@Query(" from ForumBoard where id in (?1)  ")
	List<ForumBoard> getForumBoardList(List<String> delList);
}
